package com.qeegoo.b2bautozityp.moudle.detail.adapter;


import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by HongQian.Wang on 2017/10/20.
 */

public class SlideApapter extends BaseAdapter {
private List<String> mDataList=new ArrayList<>();
private String previousSelected="";
    @Override
    public int getCount() {
        return mDataList==null?0:mDataList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {

        TextView textView = new TextView(parent.getContext());
        textView.setText(mDataList.get(position));
        if(mDataList.get(position).equals(previousSelected)) {
            textView.setTextColor(Color.parseColor("#ff0000"));
        }

        return textView;
    }

    public void setDataListAndRefreshed(String previousSelected,List<String> mDataList){
         this.previousSelected=previousSelected;
         this.mDataList=mDataList;
         notifyDataSetChanged();
    }
}
